package perf.graph;

import java.io.File;

import perf.data.Binary;

public class VertexBinary extends Vertex {

	private Binary binary;
	private VertexRun parent;
	
	public VertexBinary( Binary bin, VertexRun parent ) {
		binary = bin;
		this.parent = parent;
	}
	
	@Override
	public String getLabel() {
		return (new File( binary.getName())).getName();
	}

	@Override
	public String getPath() {
		String s = (new File( binary.getName())).getParent();
		
		if ( s != null ) {
			return s;
		} else {
			return "";
		}
	}
	
	public float getCostPercent( ) {
		//TODO hardcoded index
		return binary.getCost( 0 ) / parent.getTotalCost();
	}
	
	public VertexRun getParent( ) {
		return parent;
	}
}
